<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ComparatorChain (Apache Commons Collections 4.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="ComparatorChain (Apache Commons Collections 4.0 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ComparatorChain.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/collections4/comparators/ComparableComparator.html" title="class in org.apache.commons.collections4.comparators"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/collections4/comparators/FixedOrderComparator.html" title="class in org.apache.commons.collections4.comparators"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/collections4/comparators/ComparatorChain.html" target="_top">Frames</a></li>
<li><a href="ComparatorChain.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.collections4.comparators</div>
<h2 title="Class ComparatorChain" class="title">Class ComparatorChain&lt;E&gt;</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.collections4.comparators.ComparatorChain&lt;E&gt;</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="http://download.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;E&gt;</dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">ComparatorChain&lt;E&gt;</span>
extends <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;E&gt;, <a href="http://download.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></pre>
<div class="block">A ComparatorChain is a Comparator that wraps one or more Comparators in
 sequence. The ComparatorChain calls each Comparator in sequence until either
 1) any single Comparator returns a non-zero result (and that result is then
 returned), or 2) the ComparatorChain is exhausted (and zero is returned).
 This type of sorting is very similar to multi-column sorting in SQL, and this
 class allows Java classes to emulate that kind of behaviour when sorting a
 List.
 <p>
 To further facilitate SQL-like sorting, the order of any single Comparator in
 the list can be reversed.
 <p>
 Calling a method that adds new Comparators or changes the ascend/descend sort
 <i>after compare(Object, Object) has been called</i> will result in an
 UnsupportedOperationException. However, <i>take care</i> to not alter the
 underlying List of Comparators or the BitSet that defines the sort order.
 <p>
 Instances of ComparatorChain are not synchronized. The class is not
 thread-safe at construction time, but it <i>is</i> thread-safe to perform
 multiple comparisons after all the setup operations are complete.</div>
<dl><dt><span class="strong">Since:</span></dt>
  <dd>2.0</dd>
<dt><span class="strong">Version:</span></dt>
  <dd>$Id: ComparatorChain.java 1533984 2013-10-20 21:12:51Z tn $</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../serialized-form.html#org.apache.commons.collections4.comparators.ComparatorChain">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#ComparatorChain()">ComparatorChain</a></strong>()</code>
<div class="block">Construct a ComparatorChain with no Comparators.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#ComparatorChain(java.util.Comparator)">ComparatorChain</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator)</code>
<div class="block">Construct a ComparatorChain with a single Comparator,
 sorting in the forward order</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#ComparatorChain(java.util.Comparator, boolean)">ComparatorChain</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator,
               boolean&nbsp;reverse)</code>
<div class="block">Construct a Comparator chain with a single Comparator,
 sorting in the given order</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#ComparatorChain(java.util.List)">ComparatorChain</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&gt;&nbsp;list)</code>
<div class="block">Construct a ComparatorChain from the Comparators in the
 List.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#ComparatorChain(java.util.List, java.util.BitSet)">ComparatorChain</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&gt;&nbsp;list,
               <a href="http://download.oracle.com/javase/6/docs/api/java/util/BitSet.html?is-external=true" title="class or interface in java.util">BitSet</a>&nbsp;bits)</code>
<div class="block">Construct a ComparatorChain from the Comparators in the
 given List.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#addComparator(java.util.Comparator)">addComparator</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator)</code>
<div class="block">Add a Comparator to the end of the chain using the
 forward sort order</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#addComparator(java.util.Comparator, boolean)">addComparator</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator,
             boolean&nbsp;reverse)</code>
<div class="block">Add a Comparator to the end of the chain using the
 given sort order</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#compare(E, E)">compare</a></strong>(<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&nbsp;o1,
       <a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&nbsp;o2)</code>
<div class="block">Perform comparisons on the Objects as per
 Comparator.compare(o1,o2).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#equals(java.lang.Object)">equals</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;object)</code>
<div class="block">Returns <code>true</code> iff <i>that</i> Object is
 is a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util"><code>Comparator</code></a> whose ordering is known to be
 equivalent to mine.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#hashCode()">hashCode</a></strong>()</code>
<div class="block">Implement a hash code for this comparator that is consistent with
 <a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#equals(java.lang.Object)"><code>equals</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#isLocked()">isLocked</a></strong>()</code>
<div class="block">Determine if modifications can still be made to the
 ComparatorChain.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#setComparator(int, java.util.Comparator)">setComparator</a></strong>(int&nbsp;index,
             <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator)</code>
<div class="block">Replace the Comparator at the given index, maintaining
 the existing sort order.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#setComparator(int, java.util.Comparator, boolean)">setComparator</a></strong>(int&nbsp;index,
             <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator,
             boolean&nbsp;reverse)</code>
<div class="block">Replace the Comparator at the given index in the
 ComparatorChain, using the given sort order</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#setForwardSort(int)">setForwardSort</a></strong>(int&nbsp;index)</code>
<div class="block">Change the sort order at the given index in the
 ComparatorChain to a forward sort.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#setReverseSort(int)">setReverseSort</a></strong>(int&nbsp;index)</code>
<div class="block">Change the sort order at the given index in the
 ComparatorChain to a reverse sort.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#size()">size</a></strong>()</code>
<div class="block">Number of Comparators in the current ComparatorChain.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="ComparatorChain()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ComparatorChain</h4>
<pre>public&nbsp;ComparatorChain()</pre>
<div class="block">Construct a ComparatorChain with no Comparators.
 You must add at least one Comparator before calling
 the compare(Object,Object) method, or an
 UnsupportedOperationException is thrown</div>
</li>
</ul>
<a name="ComparatorChain(java.util.Comparator)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ComparatorChain</h4>
<pre>public&nbsp;ComparatorChain(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator)</pre>
<div class="block">Construct a ComparatorChain with a single Comparator,
 sorting in the forward order</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>comparator</code> - First comparator in the Comparator chain</dd></dl>
</li>
</ul>
<a name="ComparatorChain(java.util.Comparator, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ComparatorChain</h4>
<pre>public&nbsp;ComparatorChain(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator,
               boolean&nbsp;reverse)</pre>
<div class="block">Construct a Comparator chain with a single Comparator,
 sorting in the given order</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>comparator</code> - First Comparator in the ComparatorChain</dd><dd><code>reverse</code> - false = forward sort; true = reverse sort</dd></dl>
</li>
</ul>
<a name="ComparatorChain(java.util.List)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ComparatorChain</h4>
<pre>public&nbsp;ComparatorChain(<a href="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&gt;&nbsp;list)</pre>
<div class="block">Construct a ComparatorChain from the Comparators in the
 List.  All Comparators will default to the forward
 sort order.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>list</code> - List of Comparators</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#ComparatorChain(java.util.List, java.util.BitSet)"><code>ComparatorChain(List,BitSet)</code></a></dd></dl>
</li>
</ul>
<a name="ComparatorChain(java.util.List, java.util.BitSet)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ComparatorChain</h4>
<pre>public&nbsp;ComparatorChain(<a href="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&gt;&nbsp;list,
               <a href="http://download.oracle.com/javase/6/docs/api/java/util/BitSet.html?is-external=true" title="class or interface in java.util">BitSet</a>&nbsp;bits)</pre>
<div class="block">Construct a ComparatorChain from the Comparators in the
 given List.  The sort order of each column will be
 drawn from the given BitSet.  When determining the sort
 order for Comparator at index <i>i</i> in the List,
 the ComparatorChain will call BitSet.get(<i>i</i>).
 If that method returns <i>false</i>, the forward
 sort order is used; a return value of <i>true</i>
 indicates reverse sort order.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>list</code> - List of Comparators.  NOTE: This constructor does not perform a
               defensive copy of the list</dd><dd><code>bits</code> - Sort order for each Comparator.  Extra bits are ignored,
               unless extra Comparators are added by another method.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="addComparator(java.util.Comparator)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addComparator</h4>
<pre>public&nbsp;void&nbsp;addComparator(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator)</pre>
<div class="block">Add a Comparator to the end of the chain using the
 forward sort order</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>comparator</code> - Comparator with the forward sort order</dd></dl>
</li>
</ul>
<a name="addComparator(java.util.Comparator, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addComparator</h4>
<pre>public&nbsp;void&nbsp;addComparator(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator,
                 boolean&nbsp;reverse)</pre>
<div class="block">Add a Comparator to the end of the chain using the
 given sort order</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>comparator</code> - Comparator to add to the end of the chain</dd><dd><code>reverse</code> - false = forward sort order; true = reverse sort order</dd></dl>
</li>
</ul>
<a name="setComparator(int, java.util.Comparator)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setComparator</h4>
<pre>public&nbsp;void&nbsp;setComparator(int&nbsp;index,
                 <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator)
                   throws <a href="http://download.oracle.com/javase/6/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></pre>
<div class="block">Replace the Comparator at the given index, maintaining
 the existing sort order.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>index</code> - index of the Comparator to replace</dd><dd><code>comparator</code> - Comparator to place at the given index</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - if index &lt; 0 or index &gt;= size()</dd></dl>
</li>
</ul>
<a name="setComparator(int, java.util.Comparator, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setComparator</h4>
<pre>public&nbsp;void&nbsp;setComparator(int&nbsp;index,
                 <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;&nbsp;comparator,
                 boolean&nbsp;reverse)</pre>
<div class="block">Replace the Comparator at the given index in the
 ComparatorChain, using the given sort order</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>index</code> - index of the Comparator to replace</dd><dd><code>comparator</code> - Comparator to set</dd><dd><code>reverse</code> - false = forward sort order; true = reverse sort order</dd></dl>
</li>
</ul>
<a name="setForwardSort(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setForwardSort</h4>
<pre>public&nbsp;void&nbsp;setForwardSort(int&nbsp;index)</pre>
<div class="block">Change the sort order at the given index in the
 ComparatorChain to a forward sort.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>index</code> - Index of the ComparatorChain</dd></dl>
</li>
</ul>
<a name="setReverseSort(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setReverseSort</h4>
<pre>public&nbsp;void&nbsp;setReverseSort(int&nbsp;index)</pre>
<div class="block">Change the sort order at the given index in the
 ComparatorChain to a reverse sort.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>index</code> - Index of the ComparatorChain</dd></dl>
</li>
</ul>
<a name="size()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public&nbsp;int&nbsp;size()</pre>
<div class="block">Number of Comparators in the current ComparatorChain.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Comparator count</dd></dl>
</li>
</ul>
<a name="isLocked()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isLocked</h4>
<pre>public&nbsp;boolean&nbsp;isLocked()</pre>
<div class="block">Determine if modifications can still be made to the
 ComparatorChain.  ComparatorChains cannot be modified
 once they have performed a comparison.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true = ComparatorChain cannot be modified; false =
         ComparatorChain can still be modified.</dd></dl>
</li>
</ul>
<a name="compare(java.lang.Object,java.lang.Object)">
<!--   -->
</a><a name="compare(E, E)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>compare</h4>
<pre>public&nbsp;int&nbsp;compare(<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&nbsp;o1,
          <a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&nbsp;o2)
            throws <a href="http://download.oracle.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang">UnsupportedOperationException</a></pre>
<div class="block">Perform comparisons on the Objects as per
 Comparator.compare(o1,o2).</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true#compare(T, T)" title="class or interface in java.util">compare</a></code>&nbsp;in interface&nbsp;<code><a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;</code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>o1</code> - the first object to compare</dd><dd><code>o2</code> - the second object to compare</dd>
<dt><span class="strong">Returns:</span></dt><dd>-1, 0, or 1</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang">UnsupportedOperationException</a></code> - if the ComparatorChain does not contain at least one Comparator</dd></dl>
</li>
</ul>
<a name="hashCode()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>public&nbsp;int&nbsp;hashCode()</pre>
<div class="block">Implement a hash code for this comparator that is consistent with
 <a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html#equals(java.lang.Object)"><code>equals</code></a>.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a></code>&nbsp;in class&nbsp;<code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>a suitable hash code</dd><dt><span class="strong">Since:</span></dt>
  <dd>3.0</dd></dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>equals</h4>
<pre>public&nbsp;boolean&nbsp;equals(<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;object)</pre>
<div class="block">Returns <code>true</code> iff <i>that</i> Object is
 is a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util"><code>Comparator</code></a> whose ordering is known to be
 equivalent to mine.
 <p>
 This implementation returns <code>true</code>
 iff <code><i>object</i>.<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang"><code>getClass()</code></a></code>
 equals <code>this.getClass()</code>, and the underlying
 comparators and order bits are equal.
 Subclasses may want to override this behavior to remain consistent
 with the <a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.util"><code>Comparator.equals(Object)</code></a> contract.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.util">equals</a></code>&nbsp;in interface&nbsp;<code><a href="http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;<a href="../../../../../org/apache/commons/collections4/comparators/ComparatorChain.html" title="type parameter in ComparatorChain">E</a>&gt;</code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a></code>&nbsp;in class&nbsp;<code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>object</code> - the object to compare with</dd>
<dt><span class="strong">Returns:</span></dt><dd>true if equal</dd><dt><span class="strong">Since:</span></dt>
  <dd>3.0</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ComparatorChain.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/collections4/comparators/ComparableComparator.html" title="class in org.apache.commons.collections4.comparators"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/collections4/comparators/FixedOrderComparator.html" title="class in org.apache.commons.collections4.comparators"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/collections4/comparators/ComparatorChain.html" target="_top">Frames</a></li>
<li><a href="ComparatorChain.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
